﻿@model IEnumerable<BlazorShop.Models.Order>

@{
    ViewData["Title"] = "Index";
}

<h1>订单管理</h1>

<p>
    @*<a asp-action="Create">Create New</a>*@
</p>
<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.CustomerId)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CustomerName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CustomerEmail)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Address)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Telephone)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.PayType)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.IsShip)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ShipedAt)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
@foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.CustomerId)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CustomerName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CustomerEmail)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Address)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Telephone)
            </td>
            <td>
                    @{
                        if (item.PayType == 1)
                        {
                            <span>支付宝</span>
                        }
                        else
                        {
                            <span>微信</span>
                        }
                    }
            </td>
            <td>
                    @{
                        if (item.IsShip)
                        {
                            <span>已发货</span>
                        }
                        else
                        {
                            <span>未发货</span>
                        }
                    }
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ShipedAt)
            </td>
            <td>
                @*<a asp-action="Edit" asp-route-id="@item.OrderId">Edit</a> |*@
                <a asp-action="Details" asp-route-id="@item.OrderId">Details</a> |
                @*<a asp-action="Delete" asp-route-id="@item.OrderId">Delete</a>*@
            </td>
        </tr>
}
    </tbody>
</table>
